import RandomUtil from '@/RandomUtil';
import ItemUtil from '@/ItemUtil';
import EffectCommon from 'code/Core/Common/EffectCommon';
export default class Item_雷神之锤 {
    static id = 'shdt';
    static 名称: string = '雷神之锤';
    static 描述: string = '攻击有30%机率释放一道连环闪电，最多对周围6个敌人造成180点闪电伤害';
    static 图标: string = 'assets\\item\\INV_Mace_17.blp';
    // static buffId: string = "buff_";
    // static buffType: AppBuffType = {
    //     id: "",
    //     name: Item_雷神之锤.名称,
    //     ubertip: Item_雷神之锤.描述,
    //     art: Item_雷神之锤.图标,
    // };
    static 添加技能(目标: unit) {
        // UnitAddAbility(目标, Item_雷神之锤.id);
    }
    static 释放(x: number, y: number, 来源?: unit, 目标?: unit, d?: any) {
        EffectCommon.lighting({
            target: 目标,
            caster: 来源,
            onTach: Item_雷神之锤.effect,
            loop: 5,
        });
    }
    static effect(p: lightingParams, cur: unit) {
        DamageSystemInstance.applyLightingDamage(cur, p.caster, 360);
    }
    constructor() {
        EventManager.onTakeAttack(Item_雷神之锤.spellEffect);
    }
    static spellEffect(d: DamageEventData) {
        if (!ItemUtil.isUnitHasItem(d.source, 'shdt')) return;
        if (IsUnitAlly(d.target, GetOwningPlayer(d.source))) return;
        let r = RandomUtil.randomPercent();
        if (r <= 0.3) {
            Item_雷神之锤.释放(0, 0, d.source, d.target, d);
        }
    }
}
